package _07聊天系统;

import java.io.*;
import java.net.Socket;
import java.util.Scanner;

public class ChatClient02 {
    public static void main(String[] args) throws IOException {

        Socket socket = new Socket("192.168.81.1",9999);

        while (true){
            Scanner sc = new Scanner(System.in);
            System.out.print("请输入聊天信息:");
            String line = sc.nextLine();

            PrintStream p = new PrintStream(socket.getOutputStream());
            p.println(line);

            InputStream is = socket.getInputStream();
            InputStreamReader isr =new InputStreamReader(is);
            BufferedReader br = new BufferedReader(isr);
            String readLine = br.readLine();
            System.out.println(readLine);
        }



    }
}
